<template>
  <div class="add-member">
    <!-- <el-carousel :interval="3500" arrow="always" class="d_jump" height="400">
      <el-carousel-item v-for="item in imgList" :key="item.id">
        <img :src="item.idView" class="banner_img" />
      </el-carousel-item>
    </el-carousel> -->
    <div class="tidcLogo">
      <img src="@/assets/logoq.png" alt="tidcLogo">
    </div>
    <div class="titleName">
      <span id="introduceOne">信工科创管理中心</span>
      <span id="introduceTwo">添加成员</span>
    </div>
    <div id="firstContainer">
      <el-form :model="ruleForm" :rules="rules" label-width="80px" ref="ruleForm" class="demo-ruleForm">
        <el-form-item label="姓名" prop="studentName">
          <el-input v-model="ruleForm.studentName" placeholder="请输入姓名"></el-input>
        </el-form-item>
        <el-form-item label="学号" prop="studentID">
          <el-input v-model="ruleForm.studentID" placeholder="请输入学号"></el-input>
        </el-form-item>
        <el-form-item label="班级" prop="studentClass">
          <el-input v-model="ruleForm.studentClass" placeholder="请输入班级"></el-input>
        </el-form-item>
        <el-form-item label="密码" prop="studentPassword">
          <el-input type="password" v-model="ruleForm.studentPassword" placeholder="请输入密码"></el-input>
        </el-form-item>
        <el-form-item label="籍贯" prop="nativePlace">
          <el-input v-model="ruleForm.nativePlace" placeholder="请输入籍贯"></el-input>
        </el-form-item>
        <template>
          <el-form-item label="性别" prop="studentSex" style="width:250px">
            <el-radio v-model="ruleForm.studentSex" label="1">男</el-radio>
            <el-radio v-model="ruleForm.studentSex" label="2">女</el-radio>
          </el-form-item>
        </template>
        <el-form-item label="确认密码" prop="sureStudenPassword">
          <el-input type="password" v-model="ruleForm.sureStudenPassword" placeholder="请输入确认密码"></el-input>
        </el-form-item>
        <el-form-item label="方向" prop="studentDirection">
          <el-select v-model="ruleForm.studentDirection" placeholder="请选择">
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="权限" prop="Jurisdiction" style="margin-left: 5px;">
          <el-input v-model="ruleForm.Jurisdiction" placeholder="请输入成员权限"></el-input>
        </el-form-item>
        <el-form-item label="手机号码" prop="phoneNumber">
          <el-input v-model="ruleForm.phoneNumber" placeholder="请输入手机号码"></el-input>
        </el-form-item>
        <el-form-item label="微信账号" prop="weChatAccount">
          <el-input v-model="ruleForm.weChatAccount" placeholder="请输入微信账号"></el-input>
        </el-form-item>
        <el-form-item label="QQ号码" prop="QQNumber">
          <el-input v-model="ruleForm.QQNumber" placeholder="请输入QQ号码"></el-input>
        </el-form-item>
        <el-form-item label="个人博客" prop="blogAddress">
          <el-input placeholder="请输入博客地址" v-model="ruleForm.blogAddress" style="width:300px;">
            <template slot="prepend" class="httpAddress">Http://</template>
          </el-input>
        </el-form-item>
        <el-form-item label="身份证号码" prop="studentIDNumber" label-width="100px">
          <el-input v-model="ruleForm.studentIDNumber" placeholder="请输入身份证号码" style="width:300px;"></el-input>
        </el-form-item>
        <el-form-item label="联系邮箱" prop="contactMailbox">
          <el-input placeholder="请输入联系邮箱" v-model="ruleForm.contactMailbox" style="width:300px;">
            <template slot="append">.com</template>
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitForm('ruleForm')">提交信息</el-button>
          <el-button @click="resetForm('ruleForm')">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      ruleForm: {
        studentName: "",
        studentID: "",
        studentClass: "",
        studentPassword: "",
        nativePlace: "",
        studentSex: "1",
        sureStudenPassword: "",
        studentDirection: "",
        Jurisdiction: "",
        phoneNumber: "",
        weChatAccount: "",
        QQNumber: "",
        blogAddress: "",
        studentIDNumber: "",
        contactMailbox: ""
      },
      options: [
        {
          value: "前端开发",
          label: "前端开发"
        },
        {
          value: "后端开发",
          label: "后端开发"
        },
        {
          value: "游戏开发",
          label: "游戏开发"
        },
        {
          value: "硬件开发",
          label: "硬件开发"
        },
        {
          value: "物联网开发",
          label: "物联网开发"
        },
        {
          value: "人工智能开发",
          label: "人工智能开发"
        },
        {
          value: "其他类型开发",
          label: "其他类型开发"
        }
      ],
      rules: {
        studentName: [
          { required: true, message: "请输入姓名", trigger: "blur" },
          {
            min: 3,
            max: 5,
            message: "名字长度在 3 到 5 个字符",
            trigger: "blur"
          }
        ],
        studentID: [
          { required: true, message: "请输入学号", trigger: "blur" },
          { min: 10, max: 10, message: "学号长度在10个字符", trigger: "blur" }
        ],
        studentClass: [
          { required: true, message: "请输入班级", trigger: "blur" },
          {
            min: 6,
            max: 10,
            message: "班级长度在 6 到 10 个字符",
            trigger: "blur"
          }
        ],
        studentPassword: [
          { required: true, message: "请输入密码", trigger: "blur" },
          {
            min: 6,
            max: 20,
            message: "密码长度在 6 到 20个字符",
            trigger: "blur"
          }
        ],
        nativePlace: [
          { required: true, message: "请输入籍贯", trigger: "blur" },
          {
            min: 6,
            max: 20,
            message: "籍贯长度在 6 到 20个字符",
            trigger: "blur"
          }
        ],
        studentDirection: [
          { required: true, message: "请输入选择方向", trigger: "blur" },
          {
            min: 4,
            max: 10,
            message: "籍贯长度在 4 到 10个字符",
            trigger: "blur"
          }
        ],
        studentSex: [
          { required: true, message: "请选择性别", trigger: "blur" },
          {
            min: 1,
            max: 3,
            message: "选认真选择性别",
            trigger: "blur"
          }
        ],
        sureStudenPassword: [
          { required: true, message: "请输入确认密码", trigger: "blur" },
          {
            min: 6,
            max: 20,
            message: "密码长度在 6 到 20个字符",
            trigger: "blur"
          }
        ],
        Jurisdiction: [
          { required: true, message: "请输入权限", trigger: "blur" },
          {
            min: 4,
            max: 10,
            message: "权限长度在 4 到 10个字符",
            trigger: "blur"
          }
        ],
        phoneNumber: [
          { required: true, message: "请输入手机号码", trigger: "blur" },
          {
            min: 11,
            max: 11,
            message: "手机号码长度在11个字符",
            trigger: "blur"
          }
        ],
        weChatAccount: [
          { required: true, message: "请输入微信账号", trigger: "blur" },
          {
            min: 5,
            max: 20,
            message: "微信账号长度在 5 到 20个字符",
            trigger: "blur"
          }
        ],
        QQNumber: [
          { required: true, message: "请输入QQ号码", trigger: "blur" },
          {
            min: 9,
            max: 10,
            message: "QQ号码长度在 9 到 10个字符",
            trigger: "blur"
          }
        ],
        blogAddress: [
          { required: true, message: "请输入博客地址", trigger: "blur" },
          {
            min: 10,
            max: 100,
            message: "地址长度在 10 到 100个字符",
            trigger: "blur"
          }
        ],
        studentIDNumber: [
          { required: true, message: "请输入身份证号码", trigger: "blur" },
          {
            min: 18,
            max: 18,
            message: "身份证号码长度在18位",
            trigger: "blur"
          }
        ],
        contactMailbox: [
          { required: true, message: "请输入联系邮箱", trigger: "blur" },
          {
            min: 10,
            max: 50,
            message: "联系邮箱长度在10~50位",
            trigger: "blur"
          }
        ]
      },
      imgList: [
        { id: 0, idView: require("@/assets/1.jpg") },
        { id: 1, name: "详情", idView: require("@/assets/2.jpg") },
        { id: 2, name: "推荐", idView: require("@/assets/3.jpg") },
        { id: 3, name: "详情", idView: require("@/assets/4.jpg") },
        { id: 4, name: "推荐", idView: require("@/assets/5.jpg") }
      ]
    };
  },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          alert("submit!");
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    }
  }
};
</script>
<style scoped>
.el-form-item {
  font-weight: bold;
  height: 45px;
  float: left;
  margin-left: 20px;
}
.httpAddress {
  height: 45px;
}
.el-select {
  margin-left: 10px;
}
.el-input {
  margin-left: 10px;
}
footer {
  font-size: 12px;
  text-align: center;
  opacity: 0.8;
  color: #3b3b3b;
  padding-bottom: 10px;
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}
.tidcLogo {
  width: 1000px;
  height: 90px;
  margin: 10px auto;
}
.tidcLogo img {
  height: 90px;
  width: 95px;
  float: left;
}
#titleArea {
  width: 1000px;
  margin: 20px auto;
  opacity: 0.8;
  color: #3b3b3b;
  height: 30px;
  opacity: 0.8;
  font-size: 17px;
  font-weight: bold;
}
.titleName {
  width: 1000px;
  height: 26px;
  margin: 0 auto;
  opacity: 0.7;
  color: #3b3b3b;
  border-bottom: 1px dashed #c0c4cc;
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}
.titleName #introduceOne {
  float: left;
  font-size: 14px;
  font-weight: bold;
}
.titleName #introduceTwo {
  float: right;
  font-size: 13px;
}
.banner_img {
  height: 350px;
  width: 100%;
}
#firstContainer {
  width: 1000px;
  margin: 15px auto;
}

.el-form {
  margin: 0 auto;
}
.el-button {
  width: 180px;
  margin-right: 10px;
}
</style>
